import os
from time import sleep

from selenium import webdriver
from msedge.selenium_tools import EdgeOptions
from msedge.selenium_tools import Edge


class DriverUtil:
    @staticmethod
    def get_driver():
        driver_path = '../../tools/msedgedriver91.exe'
        driver_path = os.path.abspath(driver_path)
        print(driver_path)
        options = EdgeOptions()
        options.use_chromium = True
        options.add_argument(r'--user-data-dir=C:\Users\Administrator\AppData\Local\Microsoft\Edge\User Data1')
        browser = Edge(executable_path=driver_path, options=options)
        browser.get(r'https://www.baidu.com/')
        sleep(100)
        browser.close()


if __name__ == '__main__':
    print(os.getcwd())
    DriverUtil.get_driver()
